package com.superbytecode.sample.redis.service;

import com.superbytecode.redis.client.RedisTemplateClient;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * All rights Reserved, Designed By www.super-bytecode.com
 *
 * @ProjectName: superbytecode-beacon
 * @Package: com.superbytecode.sample.service
 * @ClassName: RedisTemplateService
 * @Description: []
 * <p> </p>
 * @Author: [Lance Ting]
 * @Date: 2023/11/21 11:29
 * @Version: V1.0
 * @Copyright: 2023 www.super-bytecode.com Inc. All rights reserved.
 * TODO: 注意,本文件Lance Ting所作,如果转载或使用请标明具体出处!
 **/
@Service
public class RedisTemplateService {

    @Resource
    private RedisTemplateClient redisTemplateClient;

    /**
     * 新增数据
     *
     * @param key
     * @param value
     * @return
     */
    public int add(String key, Object value) {
        redisTemplateClient.set(key, value);
        return 0;
    }

    /**
     * 获取数据
     *
     * @param key
     * @return
     */
    public Object get(String key) {
        Object o = redisTemplateClient.get(key);
        return o;
    }
}